package com.ruoyi.column.service.impl;

import java.util.List;

import com.ruoyi.common.constant.SysConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.column.mapper.SysColumnStudentMapper;
import com.ruoyi.column.domain.SysColumnStudent;
import com.ruoyi.column.service.ISysColumnStudentService;

/**
 * 专栏学员Service业务层处理
 * 
 * @author yjf
 */
@Service
public class SysColumnStudentServiceImpl implements ISysColumnStudentService 
{
    @Autowired
    private SysColumnStudentMapper sysColumnStudentMapper;

    /**
     * 查询专栏学员
     * 
     * @param id 专栏学员主键
     * @return 专栏学员
     */
    @Override
    public SysColumnStudent selectSysColumnStudentById(Long id)
    {
        return sysColumnStudentMapper.selectSysColumnStudentById(id);
    }

    /**
     * 查询专栏学员列表
     * 
     * @param sysColumnStudent 专栏学员
     * @return 专栏学员
     */
    @Override
    public List<SysColumnStudent> selectSysColumnStudentList(SysColumnStudent sysColumnStudent)
    {
        
        if (StringUtils.isNull( sysColumnStudent.getDelFlag())) {
            sysColumnStudent.setDelFlag(SysConstants.CONSTANT_STR0);
        }
        return sysColumnStudentMapper.selectSysColumnStudentList(sysColumnStudent);
    }

    /**
     * 新增专栏学员
     * 
     * @param sysColumnStudent 专栏学员
     * @return 结果
     */
    @Override
    public int insertSysColumnStudent(SysColumnStudent sysColumnStudent)
    {
        sysColumnStudent.setCreateTime(DateUtils.getNowDate());
        sysColumnStudent.setUpdateTime(DateUtils.getNowDate());
        return sysColumnStudentMapper.insertSysColumnStudent(sysColumnStudent);
    }

    /**
     * 修改专栏学员
     * 
     * @param sysColumnStudent 专栏学员
     * @return 结果
     */
    @Override
    public int updateSysColumnStudent(SysColumnStudent sysColumnStudent)
    {
        sysColumnStudent.setUpdateTime(DateUtils.getNowDate());
        return sysColumnStudentMapper.updateSysColumnStudent(sysColumnStudent);
    }

    /**
     * 批量删除专栏学员
     * 
     * @param ids 需要删除的专栏学员主键
     * @return 结果
     */
    @Override
    public int deleteSysColumnStudentByIds(Long[] ids)
    {
        return sysColumnStudentMapper.deleteSysColumnStudentByIds(ids);
    }

    /**
     * 删除专栏学员信息
     * 
     * @param id 专栏学员主键
     * @return 结果
     */
    @Override
    public int deleteSysColumnStudentById(Long id)
    {
        return sysColumnStudentMapper.deleteSysColumnStudentById(id);
    }
}
